package com.xingdata.jjxc.activity;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;

import com.xingdata.jjxc.R;
import com.xingdata.jjxc.adapter.AddWayPointsListAdapter;
import com.xingdata.jjxc.adapter.PoiListViewAdapter;
import com.xingdata.jjxc.enty.NaviHistoryEntity;

public class AddWayPointsActivity extends Activity {

	private ListView wayPointsListView;
	private Button addNewPointButton;
	private AddWayPointsListAdapter wayPointAdapter;
	public static ArrayList<NaviHistoryEntity> wayPointArrayList = new ArrayList<NaviHistoryEntity>();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_addpoints);
		// listview初始化
		wayPointsListView = (ListView) findViewById(R.id.way_point_list);
		wayPointAdapter = new AddWayPointsListAdapter(wayPointArrayList, this);
		wayPointsListView.setAdapter(wayPointAdapter);
		addNewPointButton = (Button) findViewById(R.id.add_new_point_button);
		addNewPointButton.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(AddWayPointsActivity.this,
						NaviSerchActivity.class);
				Bundle bundle = new Bundle();
				bundle.putString("waypoint", "addpoint");
				intent.putExtras(bundle);
				startActivity(intent);
			}
		});
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		wayPointAdapter.notifyDataSetChanged();
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}

}
